const fs = require('fs')
const tex2svg = require('./tex2svg.js')

const tests = [
  //'x=\\frac{- b\\pm\\sqrt{b^{2}- 4 a c}}{2 a}',
  //'\\int_{-\\infty}^{\\infty} \\text{e}^{-x^2}\\,\\textrm{d}x',
  //'x^2 + y^2 = z^2',
  //'\\begin{aligned} (1+x)^{2n}&=\\sum_{r=0}^{2n}{\\color{red}{\\left(\\begin{array}{c}2n\\\\r\\end{array}\\right)}}x^r\\\\ &=(1+x)^n(1+x)^n\\\\ &=\\sum_{i=0}^{n}\\left(\\begin{array}{c}n\\\\i\\end{array}\\right)x^i\\sum_{j=0}^{n}\\left(\\begin{array}{c}n\\\\j\\end{array}\\right)x^j\\\\ &=\\sum_{r=0}^{2n}{\\color{red}{\\sum_{k=0}^{r}\\left(\\begin{array}{c}n\\\\k\\end{array}\\right)\\left(\\begin{array}{c}n\\\\r-k\\end{array}\\right)}}x^r \\end{aligned}',
  //'\\sum_{k=0}^{r}\\left(\\begin{array}{c}n\\\\k\\end{array}\\right)\\left(\\begin{array}{c}n\\\\r-k\\end{array}\\right)=\\left(\\begin{array}{c}2n\\\\r\\end{array}\\right)\\xrightarrow{r=n}\\sum_{k=0}^{n}\\left(\\begin{array}{c}n\\\\k\\end{array}\\right)\\left(\\begin{array}{c}n\\\\n-k\\end{array}\\right)=\\left(\\begin{array}{c}2n\\\\n\\end{array}\\right).',
  '\\mathbf{V}(x_0,x_1,\\cdots ,x_{n-1})^{\\mathsf T}\\times \\mathbf{v}= \\begin{bmatrix} 1   &1  &1  &\\cdots &1\\\\ x_0 &x_1    &x_2    &\\cdots &x_{n-1}\\\\ \\vdots  &\\vdots &\\vdots &\\ddots &\\vdots\\\\ x_0^{n-1} &x_1^{n-1}    &x_2^{n-1}    &\\cdots &x_{n-1}^{n-1}\\\\ \\end{bmatrix}\\times \\mathbf{v}',
]

tests.forEach((tex, i) => {
    tex2svg(tex).then(svg => fs.writeFileSync(`out${i}.svg`, svg))
})
